package com.ssy.lingxi.contract.api.model.constant;

import java.util.Arrays;

/**
 * 合同单据类型枚举
 * @author 伍将
 * @date 2021/3/9
 * @version 2.0.0
 */
public enum ContractOrderTypeEnum {

    /**
     * 订单 - 1
     */
    ORDER(1, "订单"),

    /**
     * 退货申请单 - 2
     */
    RETURN_GOODS(2, "退货申请单");

    private final Integer code;
    private final String message;

    ContractOrderTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        ContractOrderTypeEnum item = Arrays.stream(ContractOrderTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        return null != item ? item.getMessage() : "";
    }
}
